﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;

namespace BookStore.Models
{
    public class BillDetailModel
    {
        private string connectionString;
        private SqlConnection connect;

        public BillDetailModel()
        {
            connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString;
            connect = new SqlConnection(connectionString);
        }
        public void InsertBillDetail(string[] data)
        {
            connect.Open();
            string selectSQL;
            selectSQL = "INSERT INTO Bill_detail (bill_id,book_id,book_name,price,quantity,total_price) VALUES (N'" + data[0] + "',N'" + data[1] + "',N'" + data[2] + "',N'" + data[3] + "',N'" + data[4] + "',N'" + data[5] +  "')";
            SqlCommand cmd = new SqlCommand(selectSQL, connect);
            cmd.ExecuteNonQuery();
            connect.Close();
        }
    }
       
}
